package com.techstar.api.service;


import com.techstar.api.service.public_transport.*;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 
 * @author EinIce
 * @description API接口启动配置
 * @date 2021年7月16日
 *
 */
@Slf4j
@Service
public class TrafficFactory {
//	private List<String> distId = Arrays.asList("4553","5318","5319","5320","5321","5322","5323","5324","5325","5326");
    @Autowired
    private TaxiRealtimeVehiclesService TaxiRealtimeVehiclesService;
    @Autowired
    private TaxiRealtimeHeatmapService TaxiRealtimeHeatmapService;
    @Autowired
    private TaxiRealtimeDistrictOdService TaxiRealtimeDistrictOdService;
    @Autowired
    private BusRealtimeBusGpsService BusRealtimeBusGpsService;
    @Autowired
    private BusRealtimeHeatmapService BusRealtimeHeatmapService;
    @Autowired
    private BusTodayDistrictOd5minService BusTodayDistrictOd5minService;
    @Autowired
    private CarHailingRealtimeVehiclesService CarHailingRealtimeVehiclesService;
    @Autowired
    private RoadMonitorDevicesService RoadMonitorDevicesService;
    @Autowired
    private RoadTrafficEventService RoadTrafficEventService;
    @Autowired
    private RoadTrafficMonitorVideosService RoadTrafficMonitorVideosService;

    private List<String> typeIds = Arrays.asList("0","1","2");

    @Scheduled(fixedDelay = 1 * 60 * 1000)
    public void publicTransportService() {
        log.info("gis public_transport Service Start!");
        TaxiRealtimeVehiclesService.query();
        TaxiRealtimeDistrictOdService.query();
        TaxiRealtimeHeatmapService.query();
        BusRealtimeBusGpsService.query();
        BusRealtimeHeatmapService.query();
        BusTodayDistrictOd5minService.query();
        CarHailingRealtimeVehiclesService.query();

        typeIds.forEach(l->RoadMonitorDevicesService.query(l));
        typeIds.forEach(l->RoadTrafficEventService.query(l));
        typeIds.forEach(l->RoadTrafficMonitorVideosService.query(l));

        log.info("gis public_transport Service Finish!");
    }

}
